package main

import (
	"log"
	"syscall"
)

func main() {
	const successCallMessage = "The operation completed successfully."
	// 加载类库
	var user32 = syscall.NewLazyDLL("user32.dll")
	// 创建新的调用进程
	var getForegroundWindow = user32.NewProc("GetForegroundWindow")
	// 调用相应的函数
	activeWindowId, _, err := getForegroundWindow.Call()
	if err != nil && err.Error() != successCallMessage {
		log.Println(err)
	}
	log.Println("activeWindowId:", activeWindowId)

}
